package com.sangfor.ssl.service.auth;

import android.content.Context;
import com.sangfor.bugreport.logger.Log;
import com.sangfor.ssl.SangforAuth;
import java.io.File;
import java.util.Map;

/* loaded from: classes2.dex */
public final class AuthNativesManager {
    private static final String TAG = "AuthNativesManager";
    private Context mAppContext;

    public void init() {
    }

    public native boolean nAuthNativesManagerInit(String str, int i);

    public native String nDecryptoData(String str);

    public native String nEncryptoData(String str);

    public native String nEncryptoMobileId(String str);

    public native boolean nInitCertPublicKeyFile();

    public native String nRequetAuthorCheck();

    public native String nRequetAuthorCheck(String str, Map<String, String> map, String str2, String str3);

    private AuthNativesManager() {
        Context context = SangforAuth.getInstance().getContext();
        this.mAppContext = context;
        nAuthNativesManagerInit(context.getFilesDir().getAbsolutePath(), AuthorManager.getInstance().getClientRank());
        nInitCertPublicKeyFile();
    }

    /* loaded from: classes2.dex */
    private static final class SingletonHolder {
        private static final AuthNativesManager INSTANCE = new AuthNativesManager();

        private SingletonHolder() {
        }
    }

    public static final AuthNativesManager getInstance() {
        return SingletonHolder.INSTANCE;
    }

    public void reInitCertPublicKeyFile() {
        if (this.mAppContext == null) {
            Log.error(TAG, "reInitCertPublicKeyFile invoked failed!Context is null!");
            return;
        }
        File file = new File(this.mAppContext.getFilesDir(), AuthorManager.PUBKEY_SVPN_FILE);
        File file2 = new File(this.mAppContext.getFilesDir(), AuthorManager.PUBKEY_SXF_FILE);
        boolean exists = file.exists();
        boolean exists2 = file2.exists();
        if (exists && exists2) {
            return;
        }
        Log.warn(TAG, "publicSvpnKeyFile or publicSxfFile not exits! nInitCertPublicKeyFile execute!");
        nInitCertPublicKeyFile();
    }

    public void setAuthorResult(int i, int i2, int i3, boolean z) {
        AuthorManager.getInstance().setAuthorizationResult(i, i2, i3);
        if (z) {
            AuthorManager.getInstance().processCheckResult();
        }
    }

    public boolean updateKey() {
        return AuthorManager.getInstance().updateSvpnEncKey();
    }

    public void checkIsAuthorizationed() {
        AuthorManager.getInstance().checkIsAuthorizationed();
    }
}
